﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Core.DataAccess.Model.Migrations.ProjectComment
{
    public partial class ProjectCommentContextInit : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Comment_Attribute",
                columns: table => new
                {
                    id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    comment_key = table.Column<int>(nullable: false),
                    reply_key = table.Column<int>(nullable: true, defaultValueSql: "((0))"),
                    type = table.Column<int>(nullable: false),
                    user_key = table.Column<long>(nullable: false),
                    extend = table.Column<string>(unicode: false, nullable: false),
                    reg_time = table.Column<DateTime>(type: "datetime", nullable: true, defaultValueSql: "(getdate())")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Comment_Attribute", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "Comment_List",
                columns: table => new
                {
                    id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    project_token = table.Column<string>(unicode: false, maxLength: 21, nullable: false),
                    user_key = table.Column<long>(nullable: false),
                    information_key = table.Column<long>(nullable: false),
                    content = table.Column<string>(unicode: false, nullable: false),
                    relevant = table.Column<string>(unicode: false, maxLength: 1000, nullable: true),
                    extend = table.Column<string>(unicode: false, nullable: true),
                    check = table.Column<bool>(nullable: false),
                    reg_time = table.Column<DateTime>(type: "datetime", nullable: true, defaultValueSql: "(getdate())")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Comment_List", x => x.id);
                });

            migrationBuilder.CreateTable(
                name: "Comment_Reply",
                columns: table => new
                {
                    id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
                    comment_key = table.Column<int>(nullable: false),
                    comment_user_key = table.Column<long>(nullable: false),
                    reply_user_key = table.Column<long>(nullable: false),
                    content = table.Column<string>(unicode: false, nullable: false),
                    relevant = table.Column<string>(unicode: false, maxLength: 1000, nullable: true),
                    extend = table.Column<string>(unicode: false, nullable: true),
                    check = table.Column<bool>(nullable: false),
                    reg_time = table.Column<DateTime>(type: "datetime", nullable: true, defaultValueSql: "(getdate())")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Comment_Reply", x => x.id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Comment_Attribute");

            migrationBuilder.DropTable(
                name: "Comment_List");

            migrationBuilder.DropTable(
                name: "Comment_Reply");
        }
    }
}
